package com.fourinone.utils;

import java.util.regex.Pattern;

/**
 * @author szper
 * @version 1.0
 * @date 2019/10/20 12:20
 */
public class CheckUtils {
    public static boolean checkGrammar (String keyname) {
        if (keyname != null && Pattern.matches("^[a-z0-9A-Z_-]+$", keyname)) {
            return true;
        }
        else {
            System.out.println("|KeyNameError|| error domain or node name|");
            return false;
        }
    }
    public static boolean checkGrammar (String domain, String node) {
        return checkGrammar(domain)  && checkGrammar(node);
    }
    public static String[] getDomainNode (String domainNodeKey) {
        return domainNodeKey.split("\\.");
    }
}
